package com.tcg.prototype;

import android.content.Context;
import android.util.Log;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

public class PlayerPortraitView extends ImageView {

	private Drawable portrait;
	
	public PlayerPortraitView(Context context, AttributeSet attrs) {
		super(context, attrs);
		TypedArray attributes =getContext().obtainStyledAttributes(
		         attrs,
		         R.styleable.PlayerPortraitView);
		
		Drawable portrait = attributes.getDrawable(R.styleable.PlayerPortraitView_portrait);
		if (portrait != null)
		{
			setPortrait(portrait);
		}
		attributes.recycle();
	}

	public void setPortrait(Drawable portrait) {
		this.portrait = portrait;
		this.setImageDrawable(this.portrait);
	}
}
